<!-- home -->
<template>
  <div class="login-container">
    <div>
      <img src="../../assets/image/login/l_circle.png"
          alt=""
          class="login-circle">
      <img class="login-bac"
          src="../../assets/image/login/l_bclose.png"
          alt="" @click="goBack" />
      <p class="login-welcome">Register</p>
      <p class="login-hi">注册</p>
      </div>
    <div class="login-form">
      <div class="login-input">
        <div class="login-select"
             @click="showPicker = true"
             :value="value"><span>+{{value}}</span><span><img src="../../assets/image/login/l_arrow.png"
                 alt=""></span></div>
        <input type="number"
               class="g_input"
               v-model="phone"
               placeholder="请输入手机号">
      </div>
      <div class="next-btn">
        <van-button round
                    type="default"
                    class="g-next"
                    :disabled="phone.length != 11"
                    :class="{'ok': value}"
                    @click="goNext">下一步</van-button>
      </div>

    </div>

    <div class="login-bottom">
      <p>继续登录即代表同意<span class="login-agree"
              @click="agree">《矿银所用户协议》</span></p>
    </div>
    <!-- 弹出层 -->
    <van-popup v-model="showPicker"
               round
               position="bottom">
      <van-picker show-toolbar
                  :columns="columns"
                  @cancel="showPicker = false"
                  @confirm="onConfirm" />
    </van-popup>
  </div>
</template>

<script>
import Vue from 'vue';
import { Picker, Popup } from 'vant';
Vue.use(Picker);
Vue.use(Popup);
export default {
  data () {
    return {
      value: '86',
      phone: '',
      showPicker: false,
      columns: ['86', '87', '88', '89', '99'],
    }
  },

  computed: {},

  mounted () {

  },

  methods: {
    goBack(){
      this.$router.go(-1)
    },
    onConfirm (value) {
      this.value = value;
      this.showPicker = false;
    },
    agree () {
      this.$router.push({ path: '/product/agreement/REGISTER_AGREEMENT' })
    },
    goNext () {
      this.$router.push({ path: `/setting/${this.phone}` })
    }
  }
}
</script>
<style lang="scss" scoped>
.next-btn {
  text-align: center;
}
.login-form {
  height: auto;
  padding: 0 20px;
  margin-top: 10px;
}
.login-container {
  display: flex;
  flex-flow: column;
  justify-content: space-between;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background: #fff;
  .login-circle {
    width: 179px;
    height: 185px;
    position: absolute;
    right: 0;
    top: 0;
  }
  .login-bac {
    width: 26px;
    height: 27px;
    margin: 47px 0 23px 22px;
  }
  .login-welcome {
    width: 100%;
    height: 16px;
    font-size: 13px;
    font-weight: 500;
    color: #9fa2ff;
    line-height: 16px;
    padding-left: 23px;
  }
  .login-hi {
    width: 100%;
    height: 42px;
    line-height: 42px;
    padding-left: 23px;
    font-size: 30px;
    font-weight: 500;
    color: #3d3f6c;
  }
  .login-input {
    // width: 100%;
    height: 47px;
    background: #f2f1f8;
    border-radius: 23px;
    margin-top: 17px;
    border: 0;
    line-height: 47px;
    padding-left: 28px;
    font-size: 16px;
    color: #aaacc8;
    overflow: hidden;
  }
  .login-select {
    width: 61px;
    height: 47px;
    line-height: 47px;
    font-size: 16px;
    color: #333453;
    display: inline-block;
    span {
      margin-right: 5px;
    }
  }
  .g_input {
    display: inline-block;
    border: 0;
    width: 220px;
    color: #aaacc8;
    font-size: 16px;
    background: #f2f1f8;
  }
  .g-next {
    width: 226px;
    height: 64px;
    line-height: 64px;
    background: #f2f1f8;
    border-radius: 32px;
    margin: 0 auto;
    margin-top: 118px;
    font-size: 18px;
    text-align: center;
    color: #aaacc8;
    
    &.ok{
      background: linear-gradient( 141deg, #585DF9 0%, #5885F9 100%);
      color: #fff;
    }
  }
  .login-bottom {
    width: 100%;
    height: 60px;
    margin-top: 30px;
    text-align: center;
    font-size: 12px;
    color: #ffffff;
    color: #3d3f6c;
    .login-agree {
      color: #777bff;
    }
  }
}
</style>
